<?
class editStruct extends Beacon {

	function editStruct() {
	}

	function Generate($Process) {
		$Process=Beacon::Generate($Process);
		switch ($this->Beacon) {
			case "HEADER":
				if (is_object($GLOBALS["Systeme"]->Header))$GLOBALS["Systeme"]->Header->Add($this->getString(),"");
				break;
			case "REDIRECT":
				break;
			case "CONNEXION":
				$this->Vars = $Process->processingVars($this->Vars);
				break;
			case "TITLE":
				if (is_object($GLOBALS["Systeme"]->Header))$GLOBALS["Systeme"]->Header->setTitle($this->getString());
				break;
			case "BODY":
				if (is_object($GLOBALS["Systeme"]->Header))$GLOBALS["Systeme"]->Header->setBody($this->getString());
				break;
			case "KEYWORDS":
				if (is_object($GLOBALS["Systeme"]->Header))$GLOBALS["Systeme"]->Header->setKeywords($this->getString());
				break;
			case "REPLYTO":
				if (is_object($GLOBALS["Systeme"]->Header))$GLOBALS["Systeme"]->Header->setReplyTo($this->getString());
				break;
			case "DESCRIPTION":
				if (is_object($GLOBALS["Systeme"]->Header))$GLOBALS["Systeme"]->Header->setDescription(preg_replace("#<(.*?)>#","",html_entity_decode($this->getString())));
				break;
			case "CLASSIFICATION":
				if (is_object($GLOBALS["Systeme"]->Header))$GLOBALS["Systeme"]->Header->setClassification($this->getString());
				break;
			case "INI":
				ini_set ( $this->Vars, $this->getString() );
				$this->ChildObjects="";
				break;
		}
		return $Process;
	}

	function getString() {
		$this->Data = $this->getContent($this->ChildObjects);
		return $this->Data;
	}

	function Affich() {
		switch ($this->Beacon) {
			CASE "REDIRECT":
				$p = $this->getString();
                                if(preg_match("#\.htm#",$_SERVER["REQUEST_URI"]) )
                                {
                                    $T = explode("?",$p);
                                    if ( sizeof($T) > 1 ) {
                                        $p = $T[0] . ".htm?". $T[1];
                                    }else {
                                        $p = $p . ".htm";
                                        
                                    }
                                }
				if (preg_match("#^http#",$p)){
					header("Location:".$p);
				}
				else header("Location: http://".$_SERVER["HTTP_HOST"]."/".$p);
				break;                          
			CASE "CONNEXION":
				$Vars = explode("|",$this->Vars);
				$Login = $Vars[0];
				$Pass = $Vars[1];
                                //echo( $Login . "..." . $Pass );
				$GLOBALS["Systeme"]->Connection->Connect($Login,$Pass);
				break;
		}
	}

}


?>